import time
from time import sleep

from base.base import Base


class business_use(Base):
    # 支付管理-支付产品信息-添加支付产品-设置支付方式-上架-下架-删除
    def business_use_cases_for_payment_business(self,payment_product_id,payment_product_name,rate):
        self.switch_node("business_use _cases_for_payment_business")
        self.logger.info('支付管理-支付产品信息-上架')

        self.click("op_collapsable")  # 使用YAML中定义的键名
        self.logger.info('点击支付管理')

        self.click("op_zfcp")
        self.logger.info('点击支付产品信息')
        sleep(3)
        self.click("op_add_management",)
        self.logger.info('点击添加支付产品')
        sleep(3)
        self.send_keys("op_management_id",payment_product_id)
        self.logger.info('输入支付产品编码')
        sleep(3)
        self.send_keys("op_management_name",payment_product_name)
        self.logger.info('输入支付产品名称')
        sleep(3)
        self.click("op_click_ok")
        self.logger.info('点击提交')
        sleep(3)
        self.click("op_click_payment")
        self.logger.info('点击设置支付方式')
        sleep(3)
        self.click("op_click_payment_loc")
        self.logger.info('点击设置支付方式')
        sleep(3)
        self.send_keys("op_enter_the_payment_rate",rate)
        self.logger.info('输入支付费率')
        sleep(3)
        self.click("op_click_submit")
        self.logger.info('点击提交')
        sleep(3)
        self.click("op_zfcp_01")
        self.logger.info('再次点击支付产品信息')
        sleep(3)
        self.click("op_click_list")
        self.logger.info('点击上架')
        sleep(3)
        self.click("op_click_spam")
        self.logger.info('点击确认按钮')
        sleep(3)
        self.click("op_click_remove_from_the_listing")
        self.logger.info('点击下架')
        sleep(3)
        self.click("op_click_the_confirm_button")
        self.logger.info('点击确认按钮')
        sleep(3)

        self.click("op_click_payment_1")
        self.logger.info('点击设置支付方式')
        sleep(3)
        self.click("op_click_delect_payment")
        self.logger.info('点击删除')
        sleep(3)
        self.click("op_click_delect_ok")
        self.logger.info('点击确认按钮')
        sleep(3)
        self.click("op_zfcp_02")
        self.logger.info('点击确认按钮')
        sleep(3)


        self.click("op_click_delete")
        self.logger.info('点击删除')
        sleep(3)
        self.click("op_click_the_confirm_button_loc")
        self.logger.info('点击确认按钮')
        sleep(3)

